package com.minio.minioservier.config;


import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;


@Data
@Component
@ConfigurationProperties(prefix ="minio")
public class MinioConfig {
    /*
    ip
     */
    private String endpoint;
    /*
    账号
     */
    private String accesskey;
    /*
    密码
     */
    private String secretkey;
    /*
    桶名
     */
    public String bucketName;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accesskey , secretkey )
                .build();
    }

}
